#pragma once


// Copyright (c) 2010 Manuel Peinado Gallego <manuel.peinado@gmail.com>
// Distributed under the MIT license

// MeshNode.h : interface of the MeshNode class
//

#include "TransformNode.h"
#include "Mesh.h"
#include "AABB.h"


// ----------------------------------------------------------------------------
// Class "MeshNode"
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//  A very light wrapper for the Mesh class, which is itself a wrapper for
//  the PolygonSet class. A MeshNode is simply a Mesh that can be added to 
//  the scene tree (in 3d engine parlance, Mesh is the "entity" and MeshNode
//  is the "instance"
// ----------------------------------------------------------------------------


class MeshNode : public TransformNode
{

public:
    MeshNode(ref<Mesh> mesh) : m_mesh(mesh) {}

    // --------------------------------------------------------------
    
    // Drawable overrides
    void draw(View3d * view) const override;

    // --------------------------------------------------------------
 

protected:

    // Node overrides
    bool canBeDrawnImpl() const { return true; }
    bool isBoundedImpl() const { return true; }
    AABB getAabbLocalImpl() const { return AABB(); } 

private:

    ref<Mesh> m_mesh; 
};
